
import java.util.concurrent.Callable;

public class SumSin implements Callable<Double>, Runnable{
    private int upperB;
    private int lowerB;
    private static double step = 0.0001;
    private double result;
    //-------------------------------------------------------------------
    public SumSin(int upperBound, int lowerB) {
        this.upperB = upperBound;
        this.lowerB = lowerB;
    }
    //-------------------------------------------------------------------
    @Override
    public Double call() throws Exception {
        double res = 0.0;
        int i = 0;

        for (i = upperB; i <= lowerB; i += step) {
            res += Math.sin(i);
        }
        return res;
    }
    //-------------------------------------------------------------------
    @Override
    public void run() {
        double res = 0.0;
        int i = 0;

        for (i = upperB; i <= lowerB; i += step) {
            res += Math.sin(i);
        }
        res = result;
    }
    //-------------------------------------------------------------------
}//End class SumSin
